<?php

use yii\db\Migration;

/**
 * Class m190927_033718_task
 */
class m190927_033718_task extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="任务表"';
        $this->createTable('{{%task}}', [
            'id' => $this->primaryKey(),
            'title' => $this->string()->notNull()->comment('标题'),
            'describe' => $this->string()->comment('简介'),
            'integral' => $this->Integer()->comment('积分'),
            'sort' => $this->smallInteger()->notNull()->comment('排序'),
            'img' => $this->string()->comment('图片'),
            'status' => $this->smallInteger()->notNull()->defaultValue(1)->comment('状态'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer(),
            'deleted_at' => $this->integer(),
        ],$tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%task}}');
        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m190927_033718_task cannot be reverted.\n";

        return false;
    }
    */
}
